#pragma once

#include <string>
#include <iosfwd>
#include <boost/dynamic_bitset.hpp>

#ifdef _WIN32
#include <windows.h>
#include <wincrypt.h>
#endif

namespace utility {

//based on javascript encodeURIComponent()

std::string char2hex( char dec );
std::string urlencode(const std::string &c);

void dump_bitset(boost::dynamic_bitset<>& bitset, std::ostream& out);

std::string getMACaddress();

std::wstring mbs_to_wcs(std::string const& str);
std::string wcs_to_mbs(std::wstring const& str);
std::wstring mbs_to_wcs(std::string const& str, std::locale const& loc);
std::string wcs_to_mbs(std::wstring const& str, std::locale const& loc);

class SHA1Hash
{
public:
	SHA1Hash();
	~SHA1Hash();

	void hashData(const char* p, size_t length);
	std::string hashValue();

private:
	HCRYPTPROV _hprov;
	HCRYPTHASH _hhash;
};

}
